-
-
Notifications
You must be signed in to change notification settings - Fork 125
London |ITP-MAY-2025| Jamal Laqdiem| Book library #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can you check if any of this general feedback can help you further improve your code?
https://github.com/cjyuan/Module-Data-Flows/blob/book-library-feedback/debugging/book-library/feedback.md
Doing so can help me speed up the review process. Thanks.
- The Self-checklist in the PR description is not checked.
…js to handle and pass all criteria requested, answering questions in form of comments.
debugging/book-library/script.js
Outdated
return false; | ||
} else { | ||
let book = new Book(title.value,author.value, pages.value, check.checked); | ||
let book = new Book(inputTitle.value,inputAuthor.value, pagesToNumber, check.checked); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 46, the raw title/author input could contain leading/trailing space characters, and pageToNumber
can be a number with decimal places.
To reduce the chance of using raw input accidently, we could stored the pre-processed/sanitized/normalized input in some variables first, and reference the variables in other part of the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing, I just stored the sanitized variables before suing them before creating the Book object.
let readStatus = ""; | ||
if (myLibrary[i].check == true) { | ||
readStatus = "Yes"; | ||
} else { | ||
readStatus = "No"; | ||
} | ||
changeBut.innerText = readStatus; | ||
changeReadStatusBtn.textContent = readStatus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a good chance to practice using the ? :
conditional operator. We could rewrite the code on lines 86-92 as one statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing, you're write much better and concise to do using ternary operator.
Changes look good! Well done. |
Learners, PR Template
Self checklist
Changelist
Fixed the errors and the broken codes in the the script.js to make it work as intended.
Questions
Ask any questions you have for your reviewer.